<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子24-JS进阶（三）</title>
    </head>
    <body>
        <pre>
            <code>
                    // 例子24

                    var str = '1 plus 2 equals 3';
                    str.match(/\d+/g) // ["1", "2", "3"]

                    var url = /(\w+):\/\/([\w.]+)\/(\S*)/;
                    var url2 = /(\w+):\/\/([\w.]+)\/(\S*)/g;
                    var text = 'Visit my blog at http://www.example.com/~david';
                    var result1 = text.match(url); // ["http://www.example.com/~david", "http", "www.example.com", "~david"]
                    var result2 = text.match(url2); // ["http://www.example.com/~david"]
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/24.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>